package vip.specimen.system.datasource.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;

/**
 * *@Author: 余浪人
 * *@Date：2021/4/9 9:08
 * *@Email:yulangren520@Gmail.com
 * *@QQ:1368419640
 **/
@Setter
@Getter
@Entity
@Table(name = "article_article")
public class SystemArticleEntity extends BaseEntity {
    @ApiModelProperty(value = "标题", dataType = "String")
    private String title;
    @ApiModelProperty(value = "来源", dataType = "String")
    private String source;
    @ApiModelProperty(value = "所属分类", dataType = "List")
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "web_article_categories", joinColumns = {@JoinColumn(name = "article_uuid")}, inverseJoinColumns = {@JoinColumn(name = "categories_uuid")})
    private List<SystemArticleCategoriesEntity> categories;
    @ApiModelProperty(value = "作者", dataType = "String")
    private String author;
    @ApiModelProperty(value = "缩略图", dataType = "String")
    @Column(length = 1024)
    private String thumb;
    @ApiModelProperty(value = "状态", dataType = "Integer")
    private int state;
    @ApiModelProperty(value = "内容详情", dataType = "String")
    @Column(length = 2147483647)
    private String content;
    @ApiModelProperty(value = "标签", dataType = "List")
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "web_article_tags", joinColumns = {@JoinColumn(name = "article_uuid")}, inverseJoinColumns = {@JoinColumn(name = "tags_uuid")})
    private List<SystemArticleTagsEntity> tags;
    @ApiModelProperty(value = "关键词", dataType = "String")
    @Column(length = 1024)
    private String keyword;
    @ApiModelProperty(value = "内容描述", dataType = "String")
    @Column(length = 2048)
    private String description;
    @ApiModelProperty(value = "点击", dataType = "Integer")
    private Integer click = 0;
    @ApiModelProperty(value = "焦点", dataType = "boolean")
    private boolean focus = Boolean.FALSE;
    @ApiModelProperty(value = "滚动", dataType = "boolean")
    private boolean roll = Boolean.FALSE;
    @ApiModelProperty(value = "置顶", dataType = "boolean")
    private boolean top = Boolean.FALSE;
    @ApiModelProperty(value = "推荐", dataType = "boolean")
    private boolean recommend = Boolean.FALSE;
    @ApiModelProperty(value = "投稿", dataType = "boolean")
    private boolean contribute = Boolean.FALSE;
    @ApiModelProperty(value = "其它", dataType = "boolean")
    private boolean other = Boolean.FALSE;

    public SystemArticleEntity() {
    }

    public SystemArticleEntity(String title, String source, List<SystemArticleCategoriesEntity> categories, String author, String thumb, Integer state, String content, List<SystemArticleTagsEntity> tags, String keyword, String description, Integer click, Boolean focus, Boolean roll, Boolean top, Boolean recommend, Boolean contribute, Boolean other) {
        this.title = title;
        this.source = source;
        this.categories = categories;
        this.author = author;
        this.thumb = thumb;
        this.state = state;
        this.content = content;
        this.tags = tags;
        this.keyword = keyword;
        this.description = description;
        this.click = click;
        this.focus = focus;
        this.roll = roll;
        this.top = top;
        this.recommend = recommend;
        this.contribute = contribute;
        this.other = other;
    }
}